import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['@/views/login.vue'], resolve); }
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['@/views/error-page/404.vue'], resolve); }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => { require(['@//views/error-page/403.vue'], resolve); }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => { require(['@/views/error-page/500.vue'], resolve); }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: [
        { path: 'person', title: '个人中心', name: 'person', component: resolve => { require(['@/views/person/person.vue'], resolve); } }
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/home',
        icon: 'settings',
        name: 'home',
        title: '配置中心',
        component: Main,
        children: [
            {
                path: '/ownspace',
                icon: 'settings',
                name: 'ownspace_index',
                title: '项目配置',
                component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); }
            }
            /*,
            {
                path: '/change-pwd',
                icon: 'key',
                name: 'change-pwd',
                title: '修改密码',
                component: resolve => { require(['@/views/change-pwd/change-pwd.vue'], resolve); }
            }*/
        ]
    },
    {
        path: '/group',
        icon: 'coffee',
        name: 'group',
        title: '取码中心',
        component: Main,
        children: [
            {
                path: '/clientcode',
                icon: 'social-html5-outline',
                name: 'clientcode',
                title: '前端',
                component: resolve => { require(['@/views/group/client/clientcode.vue'], resolve); }
            },
            {
                path: '/servercode',
                icon: 'android-sunny',
                name: 'servercode',
                title: '后端',
                component: resolve => { require(['@/views/group/server/servercode.vue'], resolve); }
            },
            {
                path: '/glcode',
                icon: 'paper-airplane',
                name: 'glcode',
                title: '隔离装置适配',
                component: resolve => { require(['@/views/group/server/glcode.vue'], resolve); }
            }
        ]
    }
    ,
    {
        path: '/things',
        icon: 'social-windows-outline',
        name: 'things',
        title: '资料中心',
        component: Main,
        children: [
            {
                path: '/roadmaps',
                icon: 'steam',
                name: 'roadmaps',
                title: '里程碑',
                component: resolve => { require(['@/views/group/roadmaps/roadmaps.vue'], resolve); }
            }
            ,
            {
                path: '/codebase',
                icon: 'ribbon-a',
                name: 'codebase',
                title: '经验库',
                component: resolve => { require(['@/views/group/codebase/codebase.vue'], resolve); }
            },
            {
                path: '/webpages',
                icon: 'social-buffer',
                name: 'webpages',
                title: '网页库',
                component: resolve => { require(['@/views/group/webpages/webpages.vue'], resolve); }
            },
            {
                path: '/folders',
                icon: 'ios-folder',
                name: 'folders',
                title: '本地库',
                component: resolve => { require(['@/views/group/folders/folders.vue'], resolve); }
            },
            {
                path: '/templates',
                icon: 'ios-folder',
                name: 'templates',
                title: '模板库',
                component: resolve => { require(['@/views/group/templates/templates.vue'], resolve); }
            },
            {
                path: '/versions',
                icon: 'code-working',
                name: 'versions',
                title: '版本库',
                component: resolve => { require(['@/views/group/versions/versions.vue'], resolve); }
            }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    ...appRouter,
    page500,
    page403,
    page404
];
